part of '../repository.dart';

const _kCustomLexicalItemUseCaseExampleMarkdownKey = 'example';
const _kCustomLexicalItemUseCaseTranslationMarkdownKey = 'translation';

class _CustomLexicalItemUseCaseDto extends Equatable {
  const _CustomLexicalItemUseCaseDto._internal({
    required this.exampleMarkdown,
    required this.translationMarkdown,
  });

  final String exampleMarkdown;
  final String translationMarkdown;

  @override
  List<Object?> get props {
    return [
      exampleMarkdown,
      translationMarkdown,
    ];
  }

  factory _CustomLexicalItemUseCaseDto.fromJson(Map<String, dynamic> json) {
    return _CustomLexicalItemUseCaseDto._internal(
      exampleMarkdown: json[_kCustomLexicalItemUseCaseExampleMarkdownKey],
      translationMarkdown: json[_kCustomLexicalItemUseCaseTranslationMarkdownKey],
    );
  }

  factory _CustomLexicalItemUseCaseDto.fromEntity(
      BackupCustomLexicalItemUseCase customLexicalItemUseCase) {
    return _CustomLexicalItemUseCaseDto._internal(
      exampleMarkdown: customLexicalItemUseCase.exampleMarkdown,
      translationMarkdown: customLexicalItemUseCase.translationMarkdown,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      _kCustomLexicalItemUseCaseExampleMarkdownKey: exampleMarkdown,
      _kCustomLexicalItemUseCaseTranslationMarkdownKey: translationMarkdown,
    };
  }

  BackupCustomLexicalItemUseCase toEntity() {
    return BackupCustomLexicalItemUseCase(
      exampleMarkdown: exampleMarkdown,
      translationMarkdown: translationMarkdown,
    );
  }
}
